// vue.config.js
const path = require("path")
const resolve = (dir) => path.join(__dirname, dir)

module.exports = {
  transpileDependencies: ["vue-echarts", "resize-detector"],
  publicPath: "./", // 基本路径
  outputDir: "dist", // 输出文件目录
  // 修改less-loader，考虑后面可能修改主题颜色
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          // modifyVars: {

          // },
          javascriptEnabled: true,
        },
      },
    },
  },
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [path.resolve(__dirname, "./src/assets/css/mixin.less")], //引入全局less文件
    },
  },
  devServer: {
    //内网穿透配置
    disableHostCheck: true,
    proxy: {
      "/apis": {
        target: "http://192.168.123.23:8080",
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          "^/apis": "",
        },
      },
    },
  },
  lintOnSave: true,
  chainWebpack: (config) => {
    config.resolve.alias
      .set("@$", resolve("src"))
      .set("assets", resolve("src/assets"))
      .set("api", resolve("src/api"))
      .set("components", resolve("src/components"))
      .set("views", resolve("src/views"))
      .set("mixins", resolve("src/mixins"))
  },
}
